#!/usr/bin/perl -w

my $file = "/etc/passwd";

open (F, $file) || die "$file: $!\n";

while (<F>) {
    chomp;
    s/#.*//;
    next unless /\S/;

    my ($name, @others) = split(/:/);
    print $name . "\n" if $name =~ /^root$/;
}

close(F);
